package zoo.qboard.validator;

import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

import zoo.qboard.domain.QboardCommand;

public class QboardValidator implements Validator {

	public boolean supports(Class<?> clazz) {
		return QboardCommand.class.isAssignableFrom(clazz);
	}

	public void validate(Object target, Errors errors) {
		QboardCommand command = (QboardCommand) target;
		System.out.println(command);
		ValidationUtils.rejectIfEmptyOrWhitespace(errors,"bq_title", "required");
		ValidationUtils.rejectIfEmptyOrWhitespace(errors,"bq_content", "required");
		
	}
}